<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="DaosImpl.ClientDaoImpl" %>
<%@ page import="Beans.Client" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta charset="UTF-8">
    <title>修改信息</title>
    <link href=<%=basePath+"/stylesheets/amendInfo.css"%> type="text/css" rel="stylesheet">
    <style>
        html,body{
            height: 100%;
            margin:0;
            padding: 0;
        }
    </style>
  </head>
  
  <body>
  	<%
  		String msg = (String)session.getAttribute("msg");
  		if(msg!=null&&msg!=""){
  			%>
  					<script type="text/javascript" language="javascript">
  						var msg = '<%=msg%>'
	    				alert(msg);
	    			</script>
  			<%
  		}
  		session.removeAttribute("msg");
  	 %>
    <div id="themeText">修改信息</div>
	<div id="showRoomFrame">
	    <table cellpadding="0" cellspacing="0">
	        <thead>
	        <tr>
	            <th>顾客姓名</th>
	            <th>身份证</th>
	            <th>年龄</th>
	            <th>电话</th>
	            <th>性别</th>
	            <th>是否黑名单</th>
	            <th>操作</th>
	        </tr>
	        </thead>
	        <tbody id="mainbody">
	        	<%
	        		ArrayList<Client> clientList = new ArrayList<Client>();
	        		ClientDaoImpl clientDao = new ClientDaoImpl();
		        	clientList = clientDao.queryAllClients();
		        	String name="",idcard="",age="",phone="",sex="",blackList="";
		        	for(int i = 0;i<clientList.size();i++){
		        		name = clientList.get(i).getName();
		        		idcard = clientList.get(i).getId();
		        		age = String.valueOf(clientList.get(i).getAge());
		        		phone = clientList.get(i).getPhone();
		        		sex = clientList.get(i).getSex();
		        		blackList = clientList.get(i).getBlackList();
		        		%>
		        		<tr>
			            	<td width="10%"><%=name %></td>
			            	<td width="15%"><%=idcard %></td>
			            	<td width="10%"><%=age %></td>
			            	<td width="15%"><%=phone %></td>
			            	<td width="10%"><%=sex %></td>
			            	<td width="10%"><%=blackList %></td>
			            	<td width="30%">
	                			<button style="padding: 5px 15px;border: 1px solid orange;border-radius: 5px;background-color: orange" id="amendBtn" onclick="showDlg('<%=name%>','<%=idcard%>','<%=age%>','<%=phone%>','<%=sex%>','<%=blackList%>')">修改信息</button>
	                			<button style="padding: 5px 15px;border: 1px solid black;border-radius: 5px;background-color: black" onclick="showBlack('<%=name%>','<%=idcard%>')">拉黑</button>
	                			<button style="padding: 5px 15px;border: 1px solid greenyellow;border-radius: 5px;background-color: greenyellow" onclick="showDelDlg('<%=name%>','<%=idcard%>')">解除黑名单</button>
	            			</td>
		        		</tr>
		        		<%
		        	}
	        	 %>
	        </tbody>
	    </table>
	    <div id="mask">
            <div class="mask">
                <div class="title">
                    编辑
                    <span onclick="" id="closeBtn">X</span>
                </div>
                <div class="content">
                    <form action="/HotelSystem/Servlets/AmendInfoServlet" method="post">
                        <div>
                            <span>顾 客 姓 名：&nbsp;</span>
                            <input type="text" name="name" value="" placeholder="顾客姓名" id="name">
                        </div>
                        <div>
                            <span>身&nbsp;&nbsp;份&nbsp;&nbsp;证：&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="idcard" value="" placeholder="身份证" id="idcard">
                        </div>
                        <div>
                            <span>年&nbsp;&nbsp;龄&nbsp;&nbsp;：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="age" value="" placeholder="年龄" id="age">
                        </div>
                        <div>
                            <span>电&nbsp;&nbsp;话：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="phone" value="" placeholder="电话" id="phone">
                        </div>
                        <div>
                            <span>性&nbsp;&nbsp;别：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="sex" value="" placeholder="性别" id="sex">
                        </div>
                        <div>
                            <span>是否黑名单：&nbsp;</span>
                            <input type="text" name="blackList" value="否" placeholder="是否黑名单" readonly=”readonly” id="blackList">
                        </div>
                        <input type="hidden" value="" name="lastid" id="lastid">
                        <div>
                            <input value="更新" type="submit" class="amendBtn" style="width: 56px" id="updateBtn">
                            <button id="cancelBtn" type="button">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
        <div id="addBlackMask">
	        <div class="addBlackMask">
	            <div class="title">
	                是否拉黑
	                <span onclick="closeBlack()">X</span>
	            </div>
	            <div style="text-align: center;line-height: 100px" id="blackText"></div>
            	<div class="blackBtn">
	                <form action="/HotelSystem/Servlets/AddBlackServlet" method="post">
	                	<input type="hidden" name="blackId" value="" id="blackId">
	                    <input type="submit" value="确定" class="sureBlack">
	                    <button onclick="closeBlack()" type="button">取消</button>
                	</form>
            	</div>
	        </div>
    	</div>
    	
    	<div id="delBlackMask">
        <div class="delBlackMask">
            <div class="title">
               	 是否解除拉黑
                <span onclick="closeDelDlg()" >X</span>
            </div>
            <div style="text-align: center;line-height: 100px" id="delBlackText"></div>
            <div class="blackBtn">
                <form action="/HotelSystem/Servlets/DelBlackServlet" method="post">
                	<input type="hidden" name="delBlackId" value="" id="delBlackId">
                    <input type="submit" value="确定" class="sureBlack">
                    <button onclick="closeDelDlg()" type="button">取消</button>
                </form>
            </div>
        </div>
    </div>
    	
	</div>
	<script src="javascripts/amendInfo.js"></script>
  </body>
</html>
